import pygame


class Text(object):
    font = 'notosanscjksc'
    size = 26
    color = (255, 255, 255)
    text = ''
    surface = None

    def __init__(self, text, size=26, color=(255, 255, 255), font='notosanscjksc'):
        self.text = text
        self.color = color
        self.size = size
        self.font = font

        pygame.font.init()
        font = pygame.font.SysFont(self.font, self.size)
        self.surface = font.render(self.text, True, self.color)

    def display(self, screen, position):
        # 绘制文字
        screen.blit(self.surface, position)
